package com.program.cloudmanage.tripteam.service;

import com.program.cloudmanage.tripteam.domain.Person;
import com.program.cloudmanage.tripteam.persistence.PersonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PersonService {
    @Autowired
    private PersonMapper personMapper;
    public PersonService(){}
    public List<Person> showPersons(){
        return personMapper.showPerson();
    }
    public List<Person> searchPersonByTeamId(String teamId){
         return personMapper.searchPersonByTeamId(teamId);
    }
     public Person searchPersonByCarId(String carId){
         return personMapper.searchPersonByCarId(carId);
    }
    public Person  searchPerson(String personId){
         return personMapper.searchPerson(personId);
    }
    public void insertPerson(Person person){
        personMapper.insertPerson(person.getPersonid(),person.getType(),person.getCarid(),person.getAge(),person.getPersonname(),person.getTeamid());
    }
    public void deletePerson(String personid)
    {
        personMapper.deletePerson(personid);
    }
    public void updatePerson(Person person){personMapper.updatePerson(person.getPersonid(),person.getType(),person.getCarid(),person.getAge(),person.getPersonname());}
}
